package com.wn.factoryUtils;

import com.wn.entity.Person;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

public class ThirdFactory {

    public Person doPerson() {
        Properties p = new Properties();
        InputStream resourceAsStream = ThirdFactory.class.getResourceAsStream("doPerson.properties");
        String personName="";
        Person person = null;
        try {
            p.load(resourceAsStream);
            personName = p.getProperty("person");
            person = (Person)Class.forName(personName).newInstance();
        } catch (IOException e) {
            e.printStackTrace();
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        } catch (InstantiationException e) {
            e.printStackTrace();
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        }
        return person;

    }

}
